package com.codingman.jdbcdemo;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

//batch
public class Demo6 {

	public static void main(String[] args) {
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");
			Connection con = DriverManager.getConnection("jdbc:mysql://45.77.187.28:3306/codingdb", "codingman",
					"Cm@123456");
			PreparedStatement ps = con.prepareStatement("insert into employee values(?,?,?)");  
			ps.setInt(1, 106);
			ps.setString(2, "Six");
			ps.setFloat(3, 600);
			ps.addBatch();
			
			ps.setInt(1, 107);
			ps.setString(2, "Seven");
			ps.setFloat(3, 700);
			ps.addBatch();
			
			ps.executeBatch();
			
			con.close();

		} catch (Exception e) {
			System.out.println(e);
		}

	}

}
